<template>
  <div id="app">
    <div class="head">
      <!-- 头部样式 -->
    </div>
    <div class="body">
      <!-- 内容样式 -->
      <div class="left">
        <!-- 渲染左侧导航列表 -->

        <el-menu
          default-active="1"
          class="el-menu-vertical-demo"
          @open="handleOpen"
          @close="handleClose"
          router
        >
          <el-menu-item index="1" route='/home'>
            <i class="el-icon-menu"></i>
            <span slot="title">主页</span>
          </el-menu-item>
          <el-submenu index="2">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>创作</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="2-1" route="/create/hot"
                >近期热点</el-menu-item
              >
              <el-menu-item index="2-2" route="/create/potential"
                >潜力问题</el-menu-item
              >
            </el-menu-item-group>
            <!-- <el-menu-item-group title="分组2"> -->
            <el-menu-item index="2-3" route="/create/featured"
              >问题推荐</el-menu-item
            >
            <!-- </el-menu-item-group> -->
          </el-submenu>
          <el-submenu index="3">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>管理</span>
            </template>
            <!-- <el-menu-item-group> -->
              <el-menu-item index="3-1" route="/manage/article"
                >内容管理</el-menu-item
              >
              <el-menu-item index="3-2" route="/manage/comment"
                >评论管理</el-menu-item
              >
            <!-- </el-menu-item-group> -->
          </el-submenu>
        </el-menu>
      </div>
      <div class="right">
        <!-- 渲染右侧内容区域 -->
        <router-view />
      </div>
    </div>
  </div>
</template>
<script>
export default {
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
  },
};
</script>

<style lang="scss">
* {
  padding: 0;
  margin: 0;
  list-style: none;
  box-sizing: border-box;
}
html,
body,
#app {
  width: 100%;
  height: 100%;
}
.head {
  width: 100%;
  height: 100px;
  background: #fcc;
  margin-bottom: 10px;
}
.body {
  width: 100%;
  height: calc(100% - 100px - 10px);
  display: flex;
  .left {
    width: 300px;
    height: 100%;
    background: #ccf;
    margin-right: 10px;
  }
  .right {
    flex: 1;
    background: #ffc;
    overflow-y: scroll;
  }
}
</style>
